/**
 * ipassbook 0.6.0
 * Copyright (C)2009 wateray and contributors
 * wateray@gmail.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package com.wateray.ipassbook.ui.model;

import java.util.Vector;

import com.wateray.ipassbook.commom.Constant;
import com.wateray.ipassbook.domain.Entity;
import com.wateray.ipassbook.domain.form.PassbookTradeForm;
import com.wateray.ipassbook.domain.form.ReceiptForm;

/**
 * @author wateray
 * @create 2009-5-29
 */
public class TransferTableModel extends AbstractPassbookTableModel {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	public TransferTableModel(Vector<String> columnNames) {
		super(columnNames);
		// TODO Auto-generated constructor stub
	}
	
	public TransferTableModel(Vector<Entity> dataVector,
			Vector<String> columnNames) {
		super(dataVector, columnNames);
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.ui.model.AbstractPassbookTableModel#getValueAt(int, int)
	 */
	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Object value = null;
		PassbookTradeForm entity = (PassbookTradeForm) (dataVector.get(rowIndex));
		
		switch (columnIndex) {
		case 0:
			value = rowIndex + 1;
			break;
		case 1:
			value = entity.getTradeDate();
			break;
		case 2:
			value = entity.getOutPassbookName() + "[" + entity.getOutCurrencyName() + "]";
			break;
		case 3:
			value = entity.getOutAmount();
			break;
		case 4:
			value = entity.getTradeRate();
			break;
		case 5:
			value = entity.getInPassbookName() + "[" + entity.getInCurrencyName() + "]";
			break;
		case 6:
			value = entity.getInAmount();
			break;
		case 7:
			value = entity.getMemo();
			break;
		}
		return value;
	}

}
